package chen.web.antispam;

/**
 * 客户端的特征
 * @author chen
 *
 */
class ClientCharacteristic extends Characteristic{
	private String ip = null;
	private String uuid = null;
	
	ClientCharacteristic(String ip, String uuid){
		if(ip == null || uuid == null)	throw new IllegalArgumentException();
		this.ip = ip;
		this.uuid = uuid;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((ip == null) ? 0 : ip.hashCode());
		result = prime * result + ((uuid == null) ? 0 : uuid.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ClientCharacteristic other = (ClientCharacteristic) obj;
		//如果ip相同或uuid相同
		if(other.ip.equals(ip) || other.uuid.equals(uuid)){
			return true;
		}
		return false;
	}

}
